package com.gxa.web.controller;

import com.alibaba.fastjson.JSONObject;
import com.gxa.common.R;
import com.gxa.service.EmpService;
import com.gxa.service.impl.EmpServiceImpl;
import com.gxa.utils.MD5Utils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/edit/info")

public class EditUserInfoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username");
        String name_num = req.getParameter("name_num");
        String oldpassword = req.getParameter("oldpassword");
        String password = req.getParameter("password");
        String repassword = req.getParameter("repassword");
        String[] params = {username,name_num,oldpassword,password,repassword};
        EmpService empService = new EmpServiceImpl();
        R r = empService.editUserInfo(params);
        resp.setContentType("application/json;charset=utf-8");
        resp.getWriter().write(JSONObject.toJSONString(r));
    }
}
